package com.toumy.controller;

import com.toumy.domain.Cate;
import com.toumy.domain.Code;
import com.toumy.domain.Result;
import com.toumy.service.ICateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/cates")
public class CateController {
    @Autowired
    private ICateService cateService;

    @GetMapping
    private Result GetAll() {
        List<Cate> list = cateService.selectAll();

        return list != null?new Result(Code.FIND_S,list,"查找成功"):new Result(Code.FIND_F,null,"查找失败");
    }
}
